﻿using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

/// <summary>
/// Summary description for MethodClassIncommod
/// </summary>
public class MethodClassIncommod
{
    SqlConnection con;
    SqlCommand command;
   
    Connection dt;
    public MethodClassIncommod()
	{
        dt = new Connection();
        con = dt.getConnect();
	}
    int execute()
    {
        SqlParameter res= new SqlParameter("@res", SqlDbType.Int);
        res.Direction = ParameterDirection.ReturnValue;
        command.Parameters.Add(res);
        command.ExecuteNonQuery();
        con.Close();
        int kq = Convert.ToInt32(res.Value);
        return kq;
    }
    public int insertIncommod(string MaNganhHang, string MoTaNganhHang)
    {
        con.Open();
        command = new SqlCommand("insertIncommod", con);
        command.CommandType = CommandType.StoredProcedure;
        command.Parameters.Add(new SqlParameter("@commodkey", MaNganhHang));
        command.Parameters.Add(new SqlParameter("@description", MoTaNganhHang));
        int kq = execute();
        return kq;
    }
    public int updateIncommod(string MaNganhHang, string MoTaNganhHang)
    {
        con.Open();
        command = new SqlCommand("updateIncommod", con);
        command.CommandType = CommandType.StoredProcedure;
        command.Parameters.Add(new SqlParameter("@commodkey", MaNganhHang));
        command.Parameters.Add(new SqlParameter("@description", MoTaNganhHang));
        int kq=execute();
        return kq;
    }
   
   
}
